﻿
@{
    ViewBag.Title = "SystemRoleAdd";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}

@section css {
    <link href="~/Assets/css/lib/bootstrap-select.css" rel="stylesheet" />
    <style>
        .table-bordered td {
            text-align: center;
        }
    </style>
}
<div class="page-content" ng-cloak ng-controller="OrganizationController" ng-init="page='@(Request.QueryString["page"].IsEmpty() ? "1" : Request.QueryString["page"])';
    GetSystemModuleList();
    PageLoading = false;
    LoadingMsg='加载中,请稍后...';
     AddModel={};
     AddModel.IsAdmin=0;
     AddModel.IsLeader=0;
     AddModel.IsDepartmentLeader=0;
          ">
    <div class="load" ng-show="PageLoading">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />

			</path>
		</svg>
            <div class="load-msg">{{LoadingMsg}}</div>
        </div>
    </div>
    <div class="page-heading">
        <h1>添加权限</h1>
        <div class="options">
            <div class="btn-toolbar">
            </div>
        </div>
    </div>
    <ol class="breadcrumb">
        <li><a>主页</a></li>
        <li><a>系统设置</a></li>
        <li><a>组织架构</a></li>
        <li><a>角色管理</a></li>
        <li class="active"><a>添加角色</a></li>
    </ol>

    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-primary">
                    <div class="panel-heading"><h2>添加角色</h2></div>
                    <div class="panel-body">
                        <form class="form-horizontal row-border">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">权限名称</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" ng-model="AddModel.RoleName">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">是否超管</label>
                                <div class="col-sm-2">
                                    <label style="margin-left:10px;margin-top:10px;" ng-click="AddModel.IsAdmin=1">
                                        <input type="radio" id="IsAdmin1" name="IsAdmin" value="1">是
                                    </label>
                                    <label style="margin-left:10px;margin-top:10px;" ng-click="AddModel.IsAdmin=0">
                                        <input type="radio" id="IsAdmin0" name="IsAdmin" ng-checked="1==1" value="0">否
                                    </label>
                                </div>
                                <label class="col-sm-4 control-label" style="color:grey;text-align:left;">适用于安委办成员，查看所有部门台账</label>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">公司领导</label>
                                <div class="col-sm-2">
                                    <label style="margin-left:10px;margin-top:10px;" ng-click="AddModel.IsLeader=1">
                                        <input type="radio" id="IsLeader1" name="IsLeader" value="1">是
                                    </label>
                                    <label style="margin-left:10px;margin-top:10px;" ng-click="AddModel.IsLeader=0">
                                        <input type="radio" id="IsLeader0" name="IsLeader" ng-checked="1==1" value="0">否
                                    </label>
                                </div>
                                <label class="col-sm-4 control-label" style="color:grey;text-align:left;">适用于公司级领导</label>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">部门领导</label>
                                <div class="col-sm-2">
                                    <label style="margin-left:10px;margin-top:10px;" ng-click="AddModel.IsDepartmentLeader=1">
                                        <input type="radio" id="IsDepartmentLeader1" name="IsDepartmentLeader" value="1">是
                                    </label>
                                    <label style="margin-left:10px;margin-top:10px;" ng-click="AddModel.IsDepartmentLeader=0">
                                        <input type="radio" id="IsDepartmentLeader0" name="IsDepartmentLeader" ng-checked="1==1" value="0">否
                                    </label>
                                </div>
                                <label class="col-sm-4 control-label" style="color:grey;text-align:left;">适用于部门长</label>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">描述/备注</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" ng-model="AddModel.Description">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">权限配置</label>
                                <div class="col-sm-8">
                                    <table class="table table-striped table-bordered" style="text-align:center;" ng-show="!PageLoading">
                                        <thead>
                                            <tr style="z-index: 10; position: relative; ">
                                                <th style="text-align: center; width: 5%">序号</th>
                                                <th style="text-align: center; width: 20%">模块</th>
                                                <th style="text-align: center; width: 20%">页面</th>
                                                <th style="text-align: center; width: 10%">查看<input type="checkbox" id="CheckedAllView" ng-click="CheckAll('CheckedAllView','View');" /></th>
                                                <th style="text-align: center; width: 10% ">新增<input type="checkbox" id="CheckedAllAdd" ng-click="CheckAll('CheckedAllAdd','Add');" /></th>
                                                <th style="text-align: center; width: 10%">编辑<input type="checkbox" id="CheckedAllModify" ng-click="CheckAll('CheckedAllModify','Modify');" /></th>
                                                <th style="text-align: center; width: 10%">删除<input type="checkbox" id="CheckedAllDelete" ng-click="CheckAll('CheckedAllDelete','Delete');" /></th>
                                            </tr>
                                        </thead>
                                        <tbody ng-repeat="c in ModuleList track by $index">
                                            <tr ng-repeat="x in c.NodeList track by $index">
                                                <td ng-if="$index ==0" rowspan={{c.NodeList.length}}>{{$parent.$parent.$index+1}}</td>
                                                <td ng-if="$index ==0" rowspan={{c.NodeList.length}}>{{c.MenuName}}</td>
                                                <td>{{x.NodeName}}</td>
                                                <td><input type="checkbox" id="View_{{x.Id}}" /></td>
                                                <td><input type="checkbox" id="Add_{{x.Id}}" /></td>
                                                <td><input type="checkbox" id="Modify_{{x.Id}}" /></td>
                                                <td><input type="checkbox" id="Delete_{{x.Id}}" /></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </form>
                        <div class="panel-footer">
                            <div class="row">
                                <div class="col-sm-8 col-sm-offset-2">
                                    <button class="btn-primary btn" ng-click="AddRole(AddModel,page);">保存</button>
                                    <a href="SystemRoleList?page={{page}}" class="btn-default btn">取消</a>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

@section Js{
    <script src="~/Assets/js/pg/Organization.js"></script>
}

